#!/bin/bash
#Script name:rsync_yumrepo.sh
RsyncBin="/usr/local/bin/rsync"
RsyncPerm='-avrt --delete --no-iconv --bwlimit=1000'
Centos_6_base='/data/yum_repo/Centos-6/Base/'
Centos_6_epel='/data/yum_repo/Centos-6/Epel/'
Centos_6_rpmforge='/data/yum_repo/Centos-6/Rpmforge/'
LogFile='/data/yum_repo/rsync_yum_log'
Date=`date +%Y-%m-%d`
#check
function check {
if [ $? -eq 0 ];then
    echo -e "\033[1;32mRsync is success!\033[0m" >>$LogFile/$Date.log
else
    echo -e "\033[1;31mRsync is fail!\033[0m" >>$LogFile/$Date.log
fi
}
if [ ! -d "$LogFile" ];then
    mkdir $LogFile
fi
#rsync centos 6 base
#echo 'Now start to rsync centos 6 base!' >>$LogFile/$Date.log
#$RsyncBin $RsyncPerm rsync://mirrors.yun-idc.com/centos/6/os/ $Centos_6_base >>$LogFile/$Date.log
#check
#rsync centos 6 epel
#echo 'Now start to rsync centos 6 epel!' >>$LogFile/$Date.log
#$RsyncBin  $RsyncPerm --exclude=SRPMS/ --exclude=ppc64/ rsync://mirrors.yun-idc.com/epel/6/ $Centos_6_epel  >>$LogFile/$Date.log
#check
# rsync centos 6 rpmforge
echo 'Now start to rsync centos 6 i386 rpmforge!' >>$LogFile/$Date.log
$RsyncBin $RsyncPerm rsync://ftp-stud.fht-esslingen.de/dag/redhat/el6/en/i386/rpmforge/ $Centos_6_rpmforge/i386/ >>$LogFile/$Date.log
check
## echo 'Now start to rsync centos 6 x86_64 rpmforge!' >>$LogFile/$Date.log
## $RsyncBin $RsyncPerm rsync://ftp-stud.fht-esslingen.de/dag/redhat/el6/en/x86_64/rpmforge/ $Centos_6_rpmforge/x86_64/ >>$LogFile/$Date.log
# check


